// [[ OnflowGenerator Entity UUID: 2592813adb8343c3b6e32ada8da6cbf5 ]]
package com.itdct.onflow.system.component.entity

import com.baomidou.mybatisplus.annotation.TableName
import com.itdct.onflow.core.annotation.Column
import com.itdct.onflow.core.annotation.ColumnRelateDict
import com.itdct.onflow.core.annotation.ColumnRelateId
import com.itdct.onflow.core.annotation.TableDescription
import com.itdct.onflow.core.entity.BaseUserEntity
import com.itdct.onflow.system.menu.entity.SysMenuEntity

/**
 * @author Zhouwx
 * @date 2025/9/15 14:54:06
 * @version 1.0
 * @description
 */
@TableDescription("系统组件")
@TableName("sys_component")
class SysComponentEntity : BaseUserEntity() {
    @Column(comment = "组件标题", nullable = false, length = 200, sort = 0, forSelect = true)
    var title = ""

    @Column(comment = "组件编码", nullable = false, length = 200, sort = 10, relateUnique = ["menu_id"])
    var code = ""

    @ColumnRelateId(targetClass = SysMenuEntity::class, targetFieldName = "title")
    @Column(comment = "菜单ID", nullable = false, indexed = true, sort = 20)
    var menuId = 0L

    @Column(comment = "是否启用", nullable = false, defaultValue = "1", sort = 30)
    var enable = true

    @ColumnRelateDict(dictCode = "sysComponentType")
    @Column(comment = "组件类型", length = 200, sort = 40)
    var type: String? = null

    @Column(comment = "图标", length = 500, nullable = true, sort = 50)
    var icon: String? = null

}